package com.fiume.travel.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.ControllerAdvice;

/**
 * <p>
 * Description:
 * </p>
 *
 * @author fiume
 * @version v1.0.0
 * @create 2021-02-12 22:04
 * @see com.fiume.travel.config
 */
// 声明此类为配置类,用以替换配置文件
@Configuration
// 约定扫描除web层以外的所有的类,即在该项目中,除了web外的类都使用该配置,而被排除的类被SSM中的SpringMvc所管理
@ComponentScan(value = "com.fiume.travel",
                excludeFilters = {
                    @ComponentScan.Filter(
                            type = FilterType.ANNOTATION,
                            classes = {
                                    Controller.class,
                                    ControllerAdvice.class //可加可不加
                            }
                    )
                }
               )
//开启事务管理
@EnableTransactionManagement
//开启aop支持
@EnableAspectJAutoProxy
public class SpringConfig {
}
